/**
 * Created by yangfan on 2016/10/20.
 */
define(["business/services/constant"], function (constant) {
    var library_baseUrl = constant.config.BASEURL_LIBRARY;
    var dataBase_baseUrl = constant.config.BASEURL_DATABASE;
    var video_baseUrl = constant.config.BASEURL_VIDEO;
    var news_baseUrl = constant.config.BASEURL_NEWS;
    var injector = angular.injector(["ng"]);

    var reqFilter = function(){};
    //function reqFilter(){};
    reqFilter.prototype.filterBaseUrl = function(requestion){
        if(typeof requestion.base !="string"){
            return
        };
        var str = "",base = getReqFilter.splitBase(requestion.base);
        if(base =="elink_library"){
            str =library_baseUrl;
            return str
        }else if(base == "elink_database"){
            str = dataBase_baseUrl;
            return str
        }else if(base == "elink_video"){
            str =video_baseUrl;
            return str
        }else if(base == "elink_news"){
            str = news_baseUrl;
            return str
        }
    };
    reqFilter.prototype.splitBase = function(str){
       var arrParam = str.split("/");
        return arrParam[0];
    };
   var  getReqFilter = new reqFilter();

    return {
        commonHttpServices:function(requestion){
            var BASEURL = getReqFilter.filterBaseUrl(requestion);
           // var rrr = "http://192.168.0.31:8080";
            return constant.httpSend(BASEURL,requestion.base,requestion);
        },
        //������ ���۵��ýӿ�
        updateCommentHttpServices:function(requestion){
            var BASEURL = requestion.url;
           // var BASEURL = '192.168.0.31:8080';
            return constant.httpSend(BASEURL,requestion.base,requestion);
        },

    }
});

